package com.home.school;

import com.home.school.model.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author: cuiyutian1
 * @date: 2021/11/13 23:53
 * @description:
 */
@ControllerAdvice
@RestControllerAdvice
public class MyExceptionHandler {

    @ExceptionHandler(value = Exception.class)
    public R exceptionHandler(Exception e) {
        return R.error(e.getMessage());
    }
}
